# 定义工具类
import time
from selenium import webdriver
class UtilsDriver():
    driver = None
    @classmethod
    def get_driver(cls):
        if cls.driver is None:
            cls.driver = webdriver.Chrome()
            cls.driver.maximize_window()
            cls.driver.implicitly_wait(10)
            cls.driver.get("http://tpshop-test.itheima.net/")
        return cls.driver

    @classmethod
    def quit_dirver(cls):
        if cls.driver is not None:
            cls.get_driver().quit()
            cls.driver = None


def get_msg():
    time.sleep(1)
    return UtilsDriver().get_driver().find_element_by_class_name("layui-layer-content").text


if __name__ == '__main__':
    d = UtilsDriver().get_driver()
    d.get("http://tpshop-test.itheima.net/")